package com.example.controller;

import com.example.domain.dto.dashboard.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.service.IDashBoardService;

import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/dashboard")
@Tag(name = "数据看板管理器")
public class DashBoardController {
    @Autowired
    private IDashBoardService dashBoardService;

    @GetMapping("/equimentStatus")
    @Operation(summary = "统计各部门设备状况")
    public List<DepartmentEquipmentStatus> equimentStatus () {
        return dashBoardService.equimentStatus();
    }

    @GetMapping("/materialStatus")
    @Operation(summary = "统计各部门物料状况")
    public Map<String, List<DepartmentMaterialStatus>> materialStatuses() {
        return dashBoardService.materialStatuses();
    }

    @GetMapping("/personnelStatus")
    @Operation(summary = "统计各部门人员情况")
    public List<DepartmentPersonnelStatus> personnelStatuses() {
        return dashBoardService.personnelStatuses();
    }

    @GetMapping("/productionStatus")
    @Operation(summary = "统计各部门生产情况")
    public List<DepartmentProductionStatus> productionStatus() {
        return dashBoardService.productionStatus();
    }

    @GetMapping("/productionDetail")
    @Operation(summary = "统计某部门生产详情")
    public List<DepartmentProductionDetail> productionDetail(Integer deptId) {
        return dashBoardService.productionDetail(deptId);
    }
}
